app.controller("jytj",function($scope,$uibModal,$rootScope,del,$state,get,$stateParams){

	var myDate = new Date();
		$scope.years=$stateParams.year||myDate.getFullYear()
	$scope.year=[]
	for(i=1;i<10;i++){
		$scope.year.push(myDate.getFullYear()-i)
	}
	$scope.year.unshift(myDate.getFullYear())
	
	$scope.search=function(){
		var param={
			year:$scope.years
		}
		$scope.lineConfig = {
		            theme:'macarons',
		            dataLoaded:true
		        };
	        
		get.list("operation/all",param).then(function(e){
			$scope.list=e
			
			
			
			$scope.sale = {
				 title : {
		        text: $scope.years+'年度销售金额统计',
		        subtext: '',
		        x:'center'
		    },
    color: ['#3398DB'],
    tooltip : {
        trigger: 'axis',
        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis : [
        {
            type : 'category',
            data : $scope.list.list,
            axisTick: {
                alignWithLabel: true
            }
        }
    ],
    yAxis : [
        {
            type : 'value'
        }
    ],
    series : [
        {
            name:'销售金额',
            type:'bar',
            barWidth: '60%',
            data:$scope.list.listName
        }
    ]
};

			
			
			
			
			$scope.sjzc={
				 title : {
		        text: '年实际支出',
		        subtext: '',
		        x:'center'
		    },
			    tooltip : {
			        trigger: 'item',
			        formatter: "{b} : {c} ({d}%)"
			    },
			    legend: {
			        type: 'scroll',
			        orient: 'vertical',
			        right: 10,
			        top: 20,
			        bottom: 20,
			        data:e.sjzc
			    },
			    series : [
			        {
			            type: 'pie',
			            radius : '65%',
			            center: ['50%', '50%'],
			            selectedMode: 'single',
			            data:e.sjzcV,
			            itemStyle: {
			                emphasis: {
			                    shadowBlur: 10,
			                    shadowOffsetX: 0,
			                    shadowColor: 'rgba(0, 0, 0, 0.5)'
			                }
			            }
			        }
			    ]
			};
			$scope.lineOptionsage = {
				 title : {
		        text: '年度总金额',
		        subtext: '',
		        x:'center'
		    },
			    tooltip : {
			        trigger: 'item',
			        formatter: "{b} : {c} ({d}%)"
			    },
			    legend: {
			        type: 'scroll',
			        orient: 'vertical',
			        right: 10,
			        top: 20,
			        bottom: 20,
			        data:e.type
			    },
			    series : [
			        {
			            type: 'pie',
			            radius : '65%',
			            center: ['50%', '50%'],
			            selectedMode: 'single',
			            data:e.acount,
			            itemStyle: {
			                emphasis: {
			                    shadowBlur: 10,
			                    shadowOffsetX: 0,
			                    shadowColor: 'rgba(0, 0, 0, 0.5)'
			                }
			            }
			        }
			    ]
			};
		})
		
		
		
		
		
	}
	$scope.search();
})
